import { defineAsyncComponent } from 'vue';
import LoadingComponent from "@/views/pub/LoadingComponent.vue";
import ErrorComponent from "@/views/pub/ErrorComponent.vue";

// 定义页面组件的类型
type PageComponent = ReturnType<typeof defineAsyncComponent>;

/** 页面声明,在home主页打开的tab必须声明 */
const pageLists: Record<string, PageComponent> = {
  Desktop: defineAsyncComponent({ 
    loader: () => import("@/views/pub/Desktop.vue"),
    loadingComponent: LoadingComponent, /* 在加载时显示 */
    errorComponent: ErrorComponent, /* 显示是否有错误 */
    delay: 1000, /* 在显示加载组件之前延迟毫秒 */
    timeout: 3000 /* 这个毫秒之后的超时 */
  }),
  SystemControlSwitch: defineAsyncComponent(() =>
    import('@/views/admin/system/SystemControlSwitch.vue')
  ),
  ListLog: defineAsyncComponent(() =>
    import('@/views/admin/system/ListLog.vue')
  ),
  ListDicts: defineAsyncComponent(() =>
    import('@/views/admin/system/ListDicts.vue')
  ),
  NotFound: defineAsyncComponent(() =>
    import('@/views/pub/NotFound.vue')
  ),
};

export default pageLists;
